import request from "@/utils/request";

export const preview = (data) => {
  return request({
    url: "/api/order/preview",
    method: "post",
    data,
  });
};

export const createOrder = (data) => {
  return request({
    url: "/api/order/createOrder",
    method: "post",
    data,
  });
};

export const getOrderList = (data) => {
  return request({
    url: "/api/order/getOrderList",
    method: "get",
    params: data,
  });
};

export const getDetail = (id) => {
  return request({
    url: "/api/order/getDetail",
    method: "get",
    params: { id },
  });
};

export const createPayOrder = (orderId) => {
  return request({
    url: "/api/order/createPayOrder",
    method: "post",
    params: { orderId },
  });
};

export const cancelOrder = (orderId) => {
  return request({
    url: "/api/order/cancelOrder",
    method: "post",
    params: { orderId },
  });
};

export const getLogisticsInfo = (orderId) => {
  return request({
    url: "/api/logisticsInfo/getInfos",
    method: "post",
    params: { orderId },
  });
};

export const createSecondPayOrder = (orderId) => {
  return request({
    url: "/api/order/createSecondPayOrder",
    method: "post",
    params: { orderId },
  });
};

export const confirmOrder = (id) => {
  return request({
    url: "/api/order/confirmOrder",
    method: "get",
    params: { id },
  });
};

export const deleteOrder = (id) => {
  return request({
    url: "/api/order/deleteOrder",
    method: "get",
    params: { id },
  });
};
